package com.jyhs.maven.proxy;

import com.jyhs.maven.dao.UserDao;
import com.jyhs.maven.dao.impl.UserDaoImpl;
import com.jyhs.maven.entity.User;

import java.sql.SQLException;
import java.text.ParseException;
import java.util.List;

public class UserDaoProxyInterfaceImpl implements UserDao {

    UserDao userDao =new UserDaoImpl();

//    public void setUserDao(UserDao userDao) {
//        this.userDao = userDao;
//    }

    @Override
    public List<User> getUserList() throws SQLException, ClassNotFoundException, ParseException, IllegalAccessException {

        long start = System.currentTimeMillis();
        List<User> userList = userDao.getUserList();
        long end = System.currentTimeMillis();
        System.out.println("UserDaoProxyImpl.getUserList() cost time: " + (end - start) + "ms");
        return userList;
    }

    @Override
    public User getUser(Long id) throws SQLException, ClassNotFoundException {
        long start = System.currentTimeMillis();
        User user = userDao.getUser(id);
        long end = System.currentTimeMillis();
        System.out.println("UserDaoProxyImpl.getUser() cost time: " + (end - start) + "ms");
        return user;
    }

    @Override
    public int deleteUser(List<Long> id) throws SQLException, ClassNotFoundException {
        return 0;
    }

}
